import React from 'react'
import {
    View,
    StyleSheet,
} from 'react-native'

import CommunityCellButton from '../button/CommunityCellButton'

export default class CommunityToolCell extends React.PureComponent {

    render() {
        return (
            <View style={styles.container}>
                <View style={styles.topline} />
                <View style={styles.content}>
                    <CommunityCellButton
                        style={styles.share}
                        type={'share'}
                        normalImg={require('../../img/share.png')}
                        title={'分享'}
                        action={this.shareAction}
                    />
                    <CommunityCellButton
                        style={styles.comment}
                        type={'comment'}
                        normalImg={require('../../img/comment.png')}
                        title={this.props.data.comment == '0' ? '评论' : this.props.data.comment}
                        action={this.commentAction}
                    />
                    <CommunityCellButton
                        style={styles.thumbup}
                        type={'thumbup'}
                        normalImg={require('../../img/thumbup_normal.png')}
                        highlightImg={require('../../img/thumbup_highlight.png')}
                        title={this.props.data.thumbup == '0' ? '点赞' : this.props.data.thumbup}
                        action={this.thumbupAction}
                    />
                </View>
                <View style={styles.bottomline} />
            </View>
        )
    }

    shareAction = () => {
        this.props.shareAction(this.props.data)
    }

    commentAction = () => {
        this.props.commentAction(this.props.data)
    }

    thumbupAction = () => {
        this.props.thumbupAction(this.props.data)
    }
}

const styles = StyleSheet.create({
    container: {
        height: 50,
    },
    content: {
        justifyContent: 'space-around',
        height: 39,
        flexDirection:'row',
        alignItems:'center'
    },
    topline: {
        marginTop:5,
        marginLeft: 10,
        marginRight: 10,
        height: 0.5,
        backgroundColor: '#eeeeee'
    },
    share: {

    },
    comment: {

    },
    thumbup: {

    },
    bottomline: {
        marginBottom: 0,
        height: 0.5,
        backgroundColor: '#eeeeee'
    }
})